const api = require('../../api/index')
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    songlistName:Array
  },

  /**
   * 组件的初始数据
   */
  data: {
    songcanok:[],
  },

  /**
   * 组件的方法列表
   */
  methods: {
        // 跳转播放页
  playdata(e){
    let ids = e.currentTarget.dataset.ids
    this.songcanplay(ids)
    let success = this.data.songcanok.success
    let msg = this.data.songcanok.message
    if (!success) {
      wx.showModal({
        title: '提示',
        content: msg,
      })
      return
    }
    wx.navigateTo({
      url: `../songdetail/songdetail?ids=${ids}`,
    })
  },
  // 判断歌曲是否可以播放
  songcanplay(ids){
    api.getsongok({id:ids})
    .then(
      content=>{
        this.setData({
            songcanok:content
        })
      }
    )
  },
  }

  


  
})